#ifndef __ZENR_API_H__
#define __ZENR_API_H__

typedef unsigned char        Uint8;
typedef unsigned short       Uint16;
typedef unsigned long        Uint32;
typedef unsigned long long   Uint64;
typedef unsigned short       Bool;
typedef unsigned long        Bool32;
typedef int T_HANDLE;

#include <zapi_system.h>
#include <zapi_HMI.h>
#include <zapi_fs.h>
#include <zapi_MDT.h>
#include <zapi_Touch.h>
#include <zapi_Audio.h>
#include <zapi_Camera.h>
#include <zapi_FM.h>

#define NUMBER_OF_ZAPI (  sizeof(ZAPI_System)       \
                        + sizeof(ZAPI_HMI)          \
                        + sizeof(ZAPI_FS)           \
                        + sizeof(ZAPI_MDT)          \
                        + sizeof(ZAPI_Touch)        \
                        + sizeof(ZAPI_Audio)        \
                        + sizeof(ZAPI_Camera)       \
                        + sizeof(ZAPI_FM)           \
                        )

#include <zapi_async_types.h>

//===========================================================================
// ZAPI Type
//

typedef struct ZENER_API {
    ZAPI_System     *System;
    ZAPI_HMI        *HMI;
    ZAPI_FS         *FileSystem;
    ZAPI_MDT        *MDT;
    ZAPI_Touch      *Touch;
    ZAPI_Audio      *Audio;
    ZAPI_Camera     *Camera;
    ZAPI_FM         *FM;

    unsigned long   ulNumOfZAPI; // must be last
} ZENER_API;



//===========================================================================
// Zener
//
#ifdef _zener

extern ZENER_API *g_ZenerApiPtr;    // define in zener

#define zapi_System     g_ZenerApiPtr->System
#define zapi_HMI        g_ZenerApiPtr->HMI
#define zapi_FS         g_ZenerApiPtr->FileSystem
#define zapi_MDT        g_ZenerApiPtr->MDT
#define zapi_Touch      g_ZenerApiPtr->Touch
#define zapi_Audio      g_ZenerApiPtr->Audio
#define zapi_Camera     g_ZenerApiPtr->Camera
#define zapi_FM         g_ZenerApiPtr->FM



Uint32 zenr_PSendAndWaitHandle(void *D, int Handle);
Uint32 zenr_PSendHandle(void *D, int Handle);

#define nu_puts         zapi_System->puts

//===========================================================================
// Nucleus
//
#else // _zener

extern ZENER_API g_ZenerApi;        // define in nucleus

extern Uint32 (*zenr_PSendAndWaitHandle)(void *D, int Handle);
extern Uint32 (*zenr_PSendHandle)(void *D, int Handle);
extern void (*zenr_NotifyDzEventByIsr)(Uint32, Uint32);

void nu_puts(const char *str);

#endif // _zener


#endif // __ZENR_API_H__

